<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="/jt-hr-WEB/css/login.css">
<script type="text/javascript" src="validateLogin.js"></script>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="language" value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}" scope="session" />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="properties.text" />
<title><fmt:message key="login" /></title>
</head>
<body>
	
	<form >
            <select id="language" name="language" onchange="submit()">
                <option value="en" ${language == 'en' ? 'selected' : ''}>English</option>
                <option value="de" ${language == 'de' ? 'selected' : ''}>Deutsch</option>
                <option value="ro" ${language == 'ro' ? 'selected' : ''}>Romana</option>
            </select>
    </form>
	
	<div id="container">
	
	<jsp:useBean id="errorMessage" class="java.lang.String" scope="session"/>
	<jsp:setProperty name="errorMessage" property="*"/> 
	
		
		<form action="login" method="post">
		
		<img id="msgLogo" alt="MSG-LOGO" src="img/msg-systems.jpg">
		<label for="name"><fmt:message key="username" />:</label>
		<td><input type="hidden" name=<fmt:message key="emptyuser" /> id="emptyuser"></td>
		<td><input type="hidden" name=<fmt:message key="emptypass" /> id="emptypass"></td>
		<td><input type="hidden" name=<fmt:message key="invalidlogin" /> id="invalidlogin"></td>
		
		<input type="name" name="username" id="username">
		
		<label for="username"><fmt:message key="password" />:</label>
		
		<input type="password" name="password" id="password">
		
		<div id="lower">
		
		
		<input type="submit" value="<fmt:message key="login" />" id="loginbutton" onclick="return validateFields()">
		
		</div>
		
		
			<% if(errorMessage.equals("error")) { %>
  				<script>
  					alert(document.getElementById("invalidlogin").name);
  				</script>
  			<% } %>

		
		</form>
		
	</div>
	
	
	<!-- End Page Content -->
<script>
	var lang='<c:out value="${language}"/>';
	select=document.getElementById("language");
	if(lang=="de_DE"||lang=="de"){
		select.options[1].defaultSelected=true;
	}
	else if(lang=="ro_RO"||lang=="ro"){
		select.options[2].defaultSelected=true;
	}
	else {
		select.options[0].defaultSelected=true;
	}

	
</script>
	
</body>
</html>